<?php
#### INVOKE METHOD #############################################################
function invoke_method(&$object, $name, $default = FALSE) {
	if (!$default) $default = 'main';
	$name = clean_method_url($name);

	if(!method_exists($object, $name)) return $object->$default();
	else return $object->$name();
}

#### METHOD CASE ###############################################################
function method_case($name) {
	$name = str_replace('-', ' ', $name);
	$name = str_replace('_', ' ', $name);
	$name = ucwords($name);
	$name = explode(' ', $name);
	$name[0] = strtolower($name[0]);
	$name = implode(NULL, $name);

	return $name;
}



#### CLEAN URL METHOD ##########################################################
function clean_method_url($name) {
	$name = str_replace('-', '', $name);
	$name = str_replace('_', '', $name);

	return $name;
}
?>